"""
多线程编程

Python的多线程可以通过 threading 模块来实现



1.threading模块的使用
thread_obj = threading.Thread(target=func) 创建线程对象
thread_obj.start()  启动线程执行
"""

import threading
import time


def sing(msg):
    while True:
        print(msg)
        time.sleep(1)


def dance(msg):
    while True:
        print(msg)
        time.sleep(1)


if __name__ == '__main__':
    # 创建一个唱歌线程
    sing_thread = threading.Thread(target=sing, args=("我要唱歌",))
    # 创建一个跳舞线程
    dance_thread = threading.Thread(target=dance, kwargs={"msg": "我要跳舞...."})

    # 启动线程，开始干活
    sing_thread.start()
    dance_thread.start()
